var mysql = require('mysql')

module.exports = function (sql, params, cb) {
    var conn = mysql.createConnection(
        {
            host: 'sh-cynosdbmysql-grp-kq4pqxo0.sql.tencentcdb.com',
            port: 24322,
            database: "yiji",
            user: 'root',
            password: 'yiji-123456'
        })
    conn.connect(function (err) {
        if (err) {
            cb(err, null)
        } else {
            conn.query(sql, params, function (err, result) {
                if (err) {
                    cb(err, null)
                } else {
                    cb(null, result)
                }
                conn.end()
            })
        }
    })
}